#include <iostream>
#include <string>

using namespace std;
int main( )
{
   string saying1( "this is a test" );
   string saying2( "this is another test" );

   // equivalent of strncmp()
   int result = saying1.compare( 0, 6, saying2, 0, 6 );
   if( result < 0 )
      cout << "\"" << saying1.substr( 0, 6 ) << "\" is less than \"" << saying2.substr( 0, 6 ) << "\"";

   else if( result > 0 )
      cout << "\"" << saying1.substr( 0, 6 ) << "\" is greater than \"" << saying2.substr( 0, 6 ) << "\"";
   else
      cout << "\"" << saying1.substr( 0, 6 ) << "\" is equal to \"" << saying2.substr( 0, 6 ) << "\"";

}
